package com.food.platformmanagement.domain;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import java.io.Serializable;
import java.util.UUID;

/**
 * id值对象
 */
@Embeddable
public class UserId implements Serializable {
    @Column(name = "id")
    private String value;

    public UserId() {
        this.value = UUID.randomUUID().toString();
    }

    public String value() {
        return this.value;
    }

    public UserId nextId() {
        return new UserId();
    }

    public static UserId of(String id) {
        UserId assignmentId = new UserId();
        assignmentId.value = UUID.fromString(id).toString();
        return assignmentId;
    }

}
